package com.cetc28.c4isr.knowledge.service;

import com.cetc28.c4isr.knowledge.bean.Vertex;
import com.cetc28.c4isr.knowledge.bean.VertexExample;
import com.cetc28.c4isr.knowledge.mapper.VertexMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class VertexService {

    private final VertexMapper vertexMapper;

    @Autowired
    public VertexService(VertexMapper vertexMapper){
        this.vertexMapper = vertexMapper;
    }

    public List<Vertex> getAllVertex(){

        VertexExample vexample = new VertexExample();
        VertexExample.Criteria criteria = vexample.createCriteria();
        criteria.andVNameIsNotNull();
        List<Vertex> vlist = vertexMapper.selectByExampleWithBLOBs(vexample);
        return vlist;
    }

    public void addEvent(){
        Vertex v1 = new Vertex("冲突.攻击",0,"");
        Vertex v2 = new Vertex("人员死亡",1,"");
        Vertex v3 = new Vertex("88人",2,"");
        Vertex v4 = new Vertex("基辅",2,"");
        Vertex v5 = new Vertex("乌克兰",2,"");
        Vertex v6 = new Vertex("乌克兰政府",3,"");
        Vertex v7 = new Vertex("苏27",2,"");
        Vertex v8 = new Vertex("苏27图片",3,"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1582794502359&di=535c519c0dc7525c5e9db0472e355f6e&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fmil%2Ftransform%2F20160130%2F6K0v-fxnzanm3853953.jpg");
        Vertex v9 = new Vertex("亲俄武装",4,"");
        Vertex v10 = new Vertex("转运",5,"");

        vertexMapper.insert(v1);
        vertexMapper.insert(v2);
        vertexMapper.insert(v3);
        vertexMapper.insert(v4);
        vertexMapper.insert(v5);
        vertexMapper.insert(v6);
        vertexMapper.insert(v7);
        vertexMapper.insert(v8);
        vertexMapper.insert(v9);
        vertexMapper.insert(v10);
    }

}
